-
Notifications
You must be signed in to change notification settings - Fork 672
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NOISSUE - Fix: Clients, Channels roles initialization and Channels connection Authz #2663
Conversation
85b38df
to
f4c1d1b
Compare
@@ -40,8 +40,8 @@ type service struct { | |||
|
|||
var _ Service = (*service)(nil) | |||
|
|||
func New(repo Repository, policy policies.Service, idProvider supermq.IDProvider, clients grpcClientsV1.ClientsServiceClient, groups grpcGroupsV1.GroupsServiceClient, sidProvider supermq.IDProvider) (Service, error) { | |||
rpms, err := roles.NewProvisionManageService(policies.ChannelType, repo, policy, sidProvider, AvailableActions(), BuiltInRoles()) | |||
func New(repo Repository, policy policies.Service, idProvider supermq.IDProvider, clients grpcClientsV1.ClientsServiceClient, groups grpcGroupsV1.GroupsServiceClient, sidProvider supermq.IDProvider, availableActions []roles.Action, builtInRoles map[roles.BuiltInRoleName][]roles.Action) (Service, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This signature looks messy. We have id provider twice, and we have way too many params. Can we group roles and actions (maybe something else as well) to a new config struct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still not addressed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Roles need short ID provider, but now we are using uuid for role , it is making the url path longer.
Already we are domain id and entity id in url.
Example requests:
For instance if Client id is 87714e08-3087-476e-8a12-c7bee595b31d
client role id is client_4tuyg19Dwd6AzwmnbWr3v6Wm
and domain id is 960c325a-c973-45f8-9c0b-f9f686941c7b
-
Get All actions of client
Method: GET URL:http://localhost/960c325a-c973-45f8-9c0b-f9f686941c7b/clients/87714e08-3087-476e-8a12-c7bee595b31d/roles/client_4tuyg19Dwd6AzwmnbWr3v6Wm/actions
-
Add All actions
Method: POST URL:http://localhost/960c325a-c973-45f8-9c0b-f9f686941c7b/clients/87714e08-3087-476e-8a12-c7bee595b31d/roles/client_4tuyg19Dwd6AzwmnbWr3v6Wm/actions
-
Delete actions
Method: POST URL:http://localhost/960c325a-c973-45f8-9c0b-f9f686941c7b/clients/87714e08-3087-476e-8a12-c7bee595b31d/roles/client_4tuyg19Dwd6AzwmnbWr3v6Wm/actions/delete
-
Delete all actions
Method: POST URL:http://localhost/960c325a-c973-45f8-9c0b-f9f686941c7b/clients/87714e08-3087-476e-8a12-c7bee595b31d/roles/client_4tuyg19Dwd6AzwmnbWr3v6Wm/actions/delete-all
-
Get All members
Method: GET URL:http://localhost/960c325a-c973-45f8-9c0b-f9f686941c7b/clients/87714e08-3087-476e-8a12-c7bee595b31d/roles/client_4tuyg19Dwd6AzwmnbWr3v6Wm/members
-
Add All members
Method: POST URL:http://localhost/960c325a-c973-45f8-9c0b-f9f686941c7b/clients/87714e08-3087-476e-8a12-c7bee595b31d/roles/client_4tuyg19Dwd6AzwmnbWr3v6Wm/members
-
Delete members
Method: POST URL:http://localhost/960c325a-c973-45f8-9c0b-f9f686941c7b/clients/87714e08-3087-476e-8a12-c7bee595b31d/roles/client_4tuyg19Dwd6AzwmnbWr3v6Wm/members
-
Delete all members
Method: POST URL:http://localhost/960c325a-c973-45f8-9c0b-f9f686941c7b/clients/87714e08-3087-476e-8a12-c7bee595b31d/roles/client_4tuyg19Dwd6AzwmnbWr3v6Wm/members/delete-all
Here Role ID : client_4tuyg19Dwd6AzwmnbWr3v6Wm is encoded using https://github.com/sqids/sqids-go
The code is here https://github.com/absmach/supermq/blob/main/pkg/sid/sid.go
So something like this https://github.com/teris-io/shortid we need
Because of licenses i could decide which one to use
Related to AvailableActions
and BuiltInRoles
could not be combined because they are using for different purpose.
AvailableActions
is list of string which helps user to understand which actions can be added to role.
BuiltInRole
contains map of built in role with respective actions , which will automatically added to entity during it creation process
f4c1d1b
to
936475e
Compare
channels/api/grpc/request.go
Outdated
"github.com/absmach/supermq/pkg/policies" | ||
) | ||
|
||
var errDomainID = errors.New("domain id required for user type") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make messages less cryptic: domain ID required for users
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed
@@ -40,8 +40,8 @@ type service struct { | |||
|
|||
var _ Service = (*service)(nil) | |||
|
|||
func New(repo Repository, policy policies.Service, idProvider supermq.IDProvider, clients grpcClientsV1.ClientsServiceClient, groups grpcGroupsV1.GroupsServiceClient, sidProvider supermq.IDProvider) (Service, error) { | |||
rpms, err := roles.NewProvisionManageService(policies.ChannelType, repo, policy, sidProvider, AvailableActions(), BuiltInRoles()) | |||
func New(repo Repository, policy policies.Service, idProvider supermq.IDProvider, clients grpcClientsV1.ClientsServiceClient, groups grpcGroupsV1.GroupsServiceClient, sidProvider supermq.IDProvider, availableActions []roles.Action, builtInRoles map[roles.BuiltInRoleName][]roles.Action) (Service, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still not addressed.
936475e
to
e1a0795
Compare
e1a0795
to
215c525
Compare
Signed-off-by: Arvindh <[email protected]>
215c525
to
170da0a
Compare
What type of PR is this?
What does this do?
Which issue(s) does this PR fix/relate to?
Have you included tests for your changes?
Did you document any new/modified feature?
Notes